import {defineStore} from "pinia";
import {ref} from "vue";
import {useBanner} from "@/API/api";
import type {Banner} from "@/models/banner";

export const useCommonStore = defineStore('common', () => {
    const banners = ref<Banner[]>([]); //Banner类型的数组
    const getBanners = async () => {
        if (banners.value.length) return;
        banners.value = await useBanner();
    };
    return {
        banners,
        getBanners,
    };
});
